import AuthService from "@src/services/AuthService";
import { IReq, IRes, INext } from "@src/routes/common/types";

class AuthController {
    login = async (req: IReq, res: IRes, next: INext) => {
        const { body } = req;
        const user = await AuthService.login(body);
        res.status(user.code).json(user);
    }

    register = async (req: IReq, res: IRes, next: INext) => {
        const { body } = req;
        const user = await AuthService.register(body);
        res.status(user.code).json(user);
    }
}

export default new AuthController();